package com.bzframework.pro.api.core.mock;

import com.bzframework.pro.api.core.OpenApiHeader;
import com.bzframework.pro.api.core.ParameterType;
import com.bzframework.pro.api.core.provider.ApiSupport;
import com.bzframework.pro.api.core.provider.ApiSupportProvider;
import com.bzframework.pro.api.core.provider.CompositeApiSupport;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

import java.util.Collections;
import java.util.List;

/**
 * @Author bingzhong
 * @Date 2025/2/25 18:03
 * @Description
 */
public class MockApiProvider implements ApiSupportProvider {

    @Override
    public List<? extends ApiSupport> create() {
        CompositeApiSupport mockApiSupport = new CompositeApiSupport();
        mockApiSupport.setId("mock-api");
        mockApiSupport.setName("mock-api");
        mockApiSupport.setUrl("http://www.baidu.com");
        mockApiSupport.setMethod(HttpMethod.GET);
        mockApiSupport.setDemoUrl("");
        mockApiSupport.setResponseType(MediaType.APPLICATION_JSON_VALUE);
        mockApiSupport.setDescription("mock-api");
        OpenApiHeader openApiHeader = new OpenApiHeader();
        openApiHeader.setName("Authorization");
        openApiHeader.setValue("1234");
        openApiHeader.setType(ParameterType.string);
        openApiHeader.setRequired(true);
        openApiHeader.setDescription("");

        mockApiSupport.setHeaders(Collections.singletonList(openApiHeader));
        mockApiSupport.setQueryParam(null);

        return Collections.singletonList(mockApiSupport);
    }
}
